<template>
  <el-select v-model="value" @change="selectOption" :clearable="canClear" filterable placeholder="请选择">
    <el-option
      v-for="item in options"
      :key="item.value"
      :label="item.label"
      :value="item.value"
      >
    </el-option>
  </el-select>
</template>

<script>
  export default {
    data() {
      return {
        value: ''
      }
    },
    props: ["options","currentVal","canClear"],
    watch: {
      immediate: true,
      currentVal:{
        immediate: true,
        handler(newValue,oldValue){
          this.value = newValue
        },
      }
    },
    methods: {
      selectOption() {
        this.$emit("selectOption",this.value)
      }
    }
  }
</script>